package com.xbts.screen.domain.vo;

import com.xbts.screen.domain.dto.WorkshopTrendDTO;
import lombok.Data;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 药水检测趋势
 */
@Data
public class WorkshopTrendVO {

    /** 规格最大值 */
    private List<String> specsMax;
    /** 规格最小值 */
    private List<String> specsMin;
    /** 管控最大值 */
    private List<String> controlMax;
    /** 管控最小值 */
    private List<String> controlMin;
    /** 白班分析值 */
    private List<String> dayShiftAnalysisValue;
    /** 夜班分析值 */
    private List<String> nightShiftAnalysisValue;
    /** 横坐标 */
    private List<String> xAxis;

    public WorkshopTrendVO(){}

    public WorkshopTrendVO(List<WorkshopTrendDTO> dtoList) {
        if(dtoList != null && dtoList.size() > 0){
            specsMax = dtoList.stream().map(v -> String.valueOf(Double.parseDouble(v.getControlMax()) * 1.2)).collect(Collectors.toList());
            specsMin = dtoList.stream().map(v -> String.valueOf(Double.parseDouble(v.getControlMin()) * 0.8)).collect(Collectors.toList());
            controlMax = dtoList.stream().map(WorkshopTrendDTO::getControlMax).collect(Collectors.toList());
            controlMin = dtoList.stream().map(WorkshopTrendDTO::getControlMin).collect(Collectors.toList());
            dayShiftAnalysisValue = dtoList.stream().map(WorkshopTrendDTO::getDayShift).collect(Collectors.toList());
            nightShiftAnalysisValue = dtoList.stream().map(WorkshopTrendDTO::getNightShift).collect(Collectors.toList());
            xAxis = dtoList.stream().map(WorkshopTrendDTO::getXAxis).collect(Collectors.toList());
        }
    }
}
